<?php

use Symfony\Component\Routing\RouteCollection;
use sframe\Route;

$collections = new RouteCollection();

$collections->add("1", new Route("/",	["_controller" => "IndexController::index"]));

/******************** 定义 /test/ 路由 ********************/

$collections->add("2", new Route("/test/{var}",	["_controller" => "TestController::index", "var" => ""]));

/******************** 定义 /api/ 路由 ********************/

$routes = new RouteCollection();

$routes->add("5", new Route("/",					["_controller" => "ApiController::index"]));
$routes->add("6", new Route("/test",				["_controller" => "ApiController::test"]));

$routes->add("7", new Route("/user/",				["_controller" => "UserController::index"]));
$routes->add("8", new Route("/user/info/{uid}",	["_controller" => "UserController::info"]));

$routes->addPrefix('/api');
$routes->setMethods(["GET","POST"]);
$routes->addRequirements(["uid" => "\d*"]);
$collections->addCollection($routes);

/******************** 路由定义完毕 ********************/

unset($routes);

return $collections;
